package org.ezplatform.office.meeting.setting.serve.dao;

import java.util.List;

import org.ezplatform.core.dao.jpa.JpaBaseDao;
import org.ezplatform.office.meeting.setting.serve.entity.ServeSet;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface ServeSetDao extends JpaBaseDao<ServeSet, String> {

    //验证查询会议服务名称是否存在
    @Query(value = "from ServeSet b where b.id not in(?1) and b.name=?2 and b.corpId=?3")
    List<ServeSet> getServeSetByName(String id, String checkdata, String corpId);

    //验证查询会议服务名称是否存在
    @Query(value = "from ServeSet b where b.name=?1 and b.corpId=?2")
    List<ServeSet> getServeSetSetByName(String checkdata, String corpId);

    //查询会议服务集合
    @Query(value = "from ServeSet b where b.id in(?1) order by b.sortNo asc,b.createdDate desc")
    List<ServeSet> getServeSetListByIds(List<String> list);

    //查询会议服务集合
    @Query(value = "from ServeSet b where b.id in (?1)")
    List<ServeSet> getServeSetByIds(List<String> list);
    
    @Query(value = "from ServeSet b where b.corpId=?1 and b.isInit=?2")
    List<ServeSet> getServeSetSet(String corpId,String isInit);
    
    @Modifying
    @Query(value = "delete from ServeSet b where b.corpId=?1 and b.isInit=?2")
    int delServeSetSet(String corpId,String isInit);
}